#ifndef _np_vec3
#define _np_vec3

#include "assert.h"

class Vec3{
public:
	float x;
	float y;
	float z;
	Vec3(const float& x, const float& y, const float& z);
	Vec3(const Vec3& src);
	~Vec3();
	Vec3 operator + (const Vec3& other) const;
	Vec3 operator - (const Vec3& other) const;

	Vec3 operator * (const float& scalar) const;
	Vec3 operator / (const float& scalar) const;
	float dotProduct(const Vec3& other);

	inline float* getPointer(){return &x;};
	inline float& operator[] (const int& idx){assert(idx<3);return getPointer()[idx];};
	static inline Vec3* const fromPointer(float* const p){return reinterpret_cast<Vec3* const>(p);};
	static inline Vec3* const fromPointer(float& p){return reinterpret_cast<Vec3* const>(&p);};
};

class _p_Vec3{
protected:
	float* v;
public:
	_p_Vec3(float* p);
	~_p_Vec3();
	_p_Vec3& add (const Vec3& other);
	_p_Vec3& dec (const Vec3& other);

	_p_Vec3& mul (const float& scalar);
	_p_Vec3& div (const float& scalar);
};

#endif //#ifndef _np_vec3
